import time

from Commen.Types_operations import Event_Click, Test_Button, Up, My
from Commen.log_logger import MyLog
from pagelocator import locator
from Commen.appiumdriver import Driver

my_log = MyLog()


class Event(Driver):

    def event(self):
        try:
            # 点击我的
            self.driver.find_element_by_xpath(locator.my_locator).click()
            my_log.info(Event_Click + '-' + My + '-我的')

            # 网络不稳定 设置等待时间
            time.sleep(5)

            # 点击测试按钮
            self.driver.find_element_by_xpath(locator.click_button).click()
            my_log.info(Event_Click + '-' + Test_Button + '-测试按钮')

            time.sleep(20)
            # 点击挂断
            self.driver.find_element_by_xpath(locator.click_up).click()
            my_log.info(Event_Click + '-' + Up + '-挂断')

            time.sleep(5)
        except Exception as e:
            my_log.info('出错啦,错误是{}'.format(e))
